﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace spk_eAuction.Classes
{
    public class Config
    {
        public static void Init(string fileName)
        {
            XmlTextReader txtReader = new XmlTextReader(fileName);
            while (txtReader.Read())
            {
                if (txtReader.IsStartElement())
                {
                    switch (txtReader.Name)
                    {
                        case "username":
                            SPaypal.APISignature.Username = txtReader["value"].ToString();
                            break;
                        case "password":
                            SPaypal.APISignature.Password = txtReader["value"].ToString();
                            break;
                        case "signature":
                            SPaypal.APISignature.Signature = txtReader["value"].ToString();
                            break;
                        case "returnUrl":
                            SPaypal.Urls.Return = txtReader["value"].ToString();
                            break;
                        case "cancelUrl":
                            SPaypal.Urls.Cancel = txtReader["value"].ToString();
                            break;
                        case "USD":
                            SPaypal.Rates.USD = float.Parse(txtReader["value"].ToString());
                            break;
                        case "mail":
                            SMail.Password = txtReader["password"].ToString();
                            SMail.Username = txtReader["username"].ToString();
                            break;
                        case "host":
                            Hostname = txtReader["name"].ToString();
                            break;
                    }
                }
            }
            txtReader.Close();
        }
        public struct SPaypal
        {
            public struct APISignature
            {
                public static string Username;
                public static string Password;
                public static string Signature;
            }
            public struct Urls
            {
                public static string Return;
                public static string Cancel;
            }
            public struct Rates
            {
                public static float USD = 26000f;
            }
        }
        public struct SMail
        {
            public static string Username;
            public static string Password;
        }
        public static string Hostname;
    }
}